<template>
    <div class="pmsSpuList">

        <div v-for="pmsProductInfo in pmsProductInfos" :key="pmsProductInfo.id">
            <van-card
            :title="pmsProductInfo.productName"
            :desc="pmsProductInfo.description"
            price="1999"
            tag:="热销"
            thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
            @click="pmsClick(pmsProductInfo.id)"></van-card>
        </div>
    </div>
</template>

<script>
    import {ApiService} from "../../axios/apiService";

    const pms = new ApiService('/pms')
    export default {
        props: {
        },
        data() {
            return{
                pmsProductInfos:[]
            }
        },
        mounted() {
            this.getPmsInfos(this.$route.params.catalog3Id);
            console.log(this.$route.params.catalog3Id)
        },
        methods:{
            getPmsInfos(catalog3Id) {
               pms.getViewById(catalog3Id).then(res=>{
                   this.pmsProductInfos = res.data
               })
            },
            pmsClick(pmsProductId) {
                //跳转到指定的商品界面
                this.$router.push({name:"item-detail",params:{spuId:pmsProductId}})
            }
        }
    };
</script>
